package com.avcdata.aoscustommade.view;

import android.content.Context;
import android.os.CountDownTimer;
import android.widget.Button;
import android.widget.EditText;

import com.avcdata.aoscustommade.R;

/**
 * Created by c.c on 2017/2/27.
 * 获取验证码类
 */
public class TimeCount extends CountDownTimer{

    private Context context;
    private EditText editText;
    private Button view;


    public TimeCount(Context context,EditText editText, Button view, long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.context =context;
        this.editText =editText;
        this.view =view;
    }
    @SuppressWarnings("deprecation")
    @Override
    public void onTick(long millisUntilFinished) {
        view.setTextColor(context.getResources().getColor(R.color.text_two));
        view.setBackgroundResource(R.drawable.round_getdynamic);
        view.setClickable(false);
        view.setText(millisUntilFinished / 1000 + context.getResources().getString(R.string.get_again));
    }
    @SuppressWarnings("deprecation")
    @Override
    public void onFinish() {
        view.setTextColor(context.getResources().getColor(R.color.blue_title));
        view.setText(context.getResources().getString(R.string.get_auth_code_again));
        view.setClickable(true);
        view.setBackgroundResource(R.drawable.round_setdynamic);
    }



}
